package com.omkarpatil.learningjpa2.mapping.onetoone.sharedpk.noid;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity(name="OtoSharedPkNoIdUser") 
@Table(name = "oto_sharedpk_noid_user")
@NamedQuery(name = "getProfileByUserId", 
		query = "SELECT p FROM OtoSharedPkNoIdProfile p WHERE p.user.id = :userId")
public class User implements Serializable {
	
	private int id;
	private String name;
	
	public User() {}

	public User(String name) {
		this.name = name;
	}

	@Id 
	@GeneratedValue
	public int getId() {
		return id;
	}
	
	private void setId(int id) {
		this.id = id;
	}
	
	@Column(nullable = false, length = 30)
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
}